<?php

namespace app\airobot\controller;

use app\airobot\CommonLogic;
use app\airobot\model\BossCommissionPercent;
use app\airobot\model\UserAssetModel;
use app\airobot\model\UserCommission;
use think\admin\Controller;
use think\facade\Db;
use think\Request;

/**
 * 超管系统-标签管理
 * Class UserTag
 * @package app\airobot\controller
 */
class UserTag extends Controller
{
    private $table = 'user_tag';
    public $commonLogic;

    /**
     * 标签管理
     * @auth true
     */
    public function index()
    {
        $this->commonLogic = new CommonLogic();
        $userInfo = $this->app->session->get("user");

        $this->title = '标签管理';
        $query = $this->_query($this->table);
        $where = [];
        if (!empty($_GET['user_id'])) {
            $where['user_id'] = $_GET['user_id'];
        }
        $query->where($where);
        $query->order('id asc')->page();
    }

    /**
     * 列表数据处理
     * @auth true
     * @param array $data
     * @throws \Exception
     */
    protected function _index_page_filter(array &$data)
    {
        /*$this->commonLogic = new CommonLogic();
        // 用户总资金、用户持仓资产
        try {
            foreach ($data as &$vo) {
                foreach ($vo as $k => $v) {
                    if (
                        $k == "new_no_pay" ||
                        $k == "new_pay_risk" ||
                        $k == "new_pay_normal" ||
                        $k == "old_no_pay" ||
                        $k == "old_pay_risk" ||
                        $k == "old_pay_normal" ||
                        $k == "old_pay_high_value" ||
                        $k == "high_risk" ||
                        $k == "observe")    {
                        if ($v == 1) {
                            $vo[$k] = "命中";
                        } else {
                            $vo[$k] = "未命中";
                        }
                    }
                }
            }
        } catch (\Exception $exception) {
            error_log(var_export($exception->getMessage(), true) . "\n", 3, "/tmp/qp.log");
        }*/
    }
}